
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>野生博主不在家</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="不爱写笔记">
<meta property="og:type" content="website">
<meta property="og:title" content="野生博主不在家">
<meta property="og:url" content="https://pengzzhao.github.io/index.html">
<meta property="og:site_name" content="野生博主不在家">
<meta property="og:description" content="不爱写笔记">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="Evelia">
<meta property="article:tag" content="docker python jenkins">
<meta name="twitter:card" content="summary">
  
  
    <link rel="icon" href="/favicon.png">
  
  
<link rel="stylesheet" href="/css/style.css">

  <!--[if lt IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.min.js"></script><![endif]-->
  
<meta name="generator" content="Hexo 7.3.0"></head>
<body>
<div id="container">
  <div id="wrap">
    <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">野生博主不在家</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//www.baidu.com/baidu" method="get" accept-charset="utf-8" class="search-form">
          <input type="search" name="word" maxlength="20" class="search-form-input" placeholder="Search">
          <input type="submit" value="" class="search-form-submit">
          <input name=tn type=hidden value="bds">
          <input name=cl type=hidden value="3">
          <input name=ct type=hidden value="2097152">
          <input type="hidden" name="si" value="pengzzhao.github.io">
        </form>
      </div>
    </div>
  </div>
</header>
    <div class="outer">
      <section id="main">
  
    <article id="post-Podman安装教程" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2024/10/11/Podman%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/" class="article-date">
  <time datetime="2024-10-11T05:15:04.000Z" itemprop="datePublished">2024-10-11</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2024/10/11/Podman%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/">Podman安装教程</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Podman简介"><a href="#Podman简介" class="headerlink" title="Podman简介"></a>Podman简介</h3><p>Podman（Pod Manager）是一个开源的容器管理工具，它提供了一个与 Docker 类似的方式来管理容器。Podman 由 Red Hat 主导开发，是完全免费和开源的。它的设计旨在能够直接运行容器和 Pod（一组容器的集合），并且它与 Kubernetes 的容器生命周期管理兼容。<br>Podman 的一个主要特点是它不依赖于守护进程（daemon），与 Docker 不同，这使得 Podman 在系统中运行时更加安全和轻量。它使用标准的容器镜像，可以从 Docker 容器镜像库或任何其他兼容 OCI（Open Container Initiative）的容器镜像库拉取镜像。</p>
<h3 id="Podman-与-Docker-的主要区别"><a href="#Podman-与-Docker-的主要区别" class="headerlink" title="Podman 与 Docker 的主要区别"></a>Podman 与 Docker 的主要区别</h3><ol>
<li><p><strong>守护进程</strong>:</p>
<p> Docker 使用单个守护进程（dockerd）来管理容器。所有的容器操作都必须通过这个守护进程进行，这可能会引入单点故障和安全风险。</p>
<p> Podman 不使用守护进程。它通过直接调用容器运行时接口（如 runC 或其他兼容 OCI 的运行时）来管理容器，从而提高了安全性，并减少了系统资源的占用。</p>
</li>
<li><p><strong>安全性</strong>:</p>
<p> Docker 在执行容器时默认以 root 用户运行，这可能导致安全隐患。</p>
<p> Podman 默认支持以非 root 用户身份运行容器，这提供了更好的安全保障。</p>
</li>
<li><p><strong>体系结构和功能</strong>:</p>
<p> Docker 配置和操作相对复杂，集成了多种功能，如镜像构建、容器运行、网络管理等。</p>
<p> Podman 提供了更加模块化的设计，可以单独使用或与其他工具（如 Buildah 和 Skopeo）集成使用，这些工具分别负责构建镜像和进行镜像仓库操作。</p>
</li>
<li><p><strong>兼容性</strong>:</p>
<p> Podman 与 Docker 命令行界面（CLI）高度兼容。大多数情况下，用户可以直接将 docker 命令替换为 podman 命令，而不需要更改其他参数或脚本。</p>
</li>
<li><p><strong>社区和生态系统</strong>:</p>
<p> Docker 拥有一个庞大且成熟的生态系统和社区，提供大量的资源和插件。</p>
<p> Podman 虽然是较新的技术，但正在快速发展，得到了 Red Hat 和开源社区的强力支持。</p>
</li>
</ol>
<p>总的来说，Podman 提供了一个更安全、更灵活的容器管理解决方案，特别是对于希望避免使用守护进程或以非 root 权限运行容器的用户。</p>
<h3 id="Podman安装"><a href="#Podman安装" class="headerlink" title="Podman安装"></a>Podman安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#卸载系统之前可能安装的Podman</span></span><br><span class="line"><span class="built_in">sudo</span> dnf -y install dnf-plugins-core</span><br><span class="line"><span class="built_in">sudo</span> dnf -y copr <span class="built_in">enable</span> rhcontainerbot/container-selinux</span><br><span class="line"><span class="built_in">sudo</span> dnf -y module <span class="built_in">disable</span> container-tools:rhel8</span><br><span class="line"><span class="built_in">sudo</span> dnf -y module <span class="built_in">enable</span> container-tools:3.0</span><br><span class="line"><span class="built_in">sudo</span> dnf -y install podman</span><br><span class="line"></span><br><span class="line"><span class="comment">#查看podman版本</span></span><br><span class="line">podman --version</span><br><span class="line"></span><br><span class="line"><span class="comment">#编辑配置文件</span></span><br><span class="line">vim /etc/containers/registries.conf</span><br></pre></td></tr></table></figure>


<h3 id="Podman-常用命令"><a href="#Podman-常用命令" class="headerlink" title="Podman 常用命令"></a>Podman 常用命令</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#查找镜像</span></span><br><span class="line">podman search xxx</span><br><span class="line"></span><br><span class="line"><span class="comment">#拉取镜像</span></span><br><span class="line">podman pull pull redis</span><br><span class="line"><span class="comment">#查看镜像</span></span><br><span class="line">podman images </span><br><span class="line"><span class="comment">#查看镜像详细信息</span></span><br><span class="line">podman inspect redis</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">#登录仓库需要用户名密码</span></span><br><span class="line">podman login  uhub.service.ucloud.cn</span><br><span class="line"><span class="comment">#登出仓库</span></span><br><span class="line">podman <span class="built_in">logout</span>  uhub.service.ucloud.cn</span><br><span class="line"><span class="comment">#删除镜像</span></span><br><span class="line">podman rmi redis</span><br><span class="line"></span><br><span class="line"><span class="comment">#启动容器</span></span><br><span class="line">podman start  xxx</span><br><span class="line"><span class="comment">#停止容器</span></span><br><span class="line">podman stop   xxx</span><br><span class="line"><span class="comment">#重启容器</span></span><br><span class="line">podman restart xxx</span><br><span class="line"><span class="comment">#删除容器</span></span><br><span class="line">podman <span class="built_in">rm</span>  xxx</span><br><span class="line"></span><br><span class="line"><span class="comment">#查找正在运行中的容器</span></span><br><span class="line">podman ps</span><br><span class="line"></span><br><span class="line"><span class="comment">#进入容器</span></span><br><span class="line">podman <span class="built_in">exec</span> -it redis /bin/bash</span><br><span class="line"></span><br></pre></td></tr></table></figure>

      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://pengzzhao.github.io/2024/10/11/Podman%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/" data-id="cm25qvjy40000m2d8032jch7h" class="article-share-link">分享到</a>
      

      

      
    </footer>
  </div>
  
</article>


  
    <article id="post-Docker安装教程" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2024/10/09/Docker%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/" class="article-date">
  <time datetime="2024-10-08T16:00:00.000Z" itemprop="datePublished">2024-10-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2024/10/09/Docker%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/">Docker安装教程</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Docker简介"><a href="#Docker简介" class="headerlink" title="Docker简介"></a>Docker简介</h3><p>Docker是一个开源的容器化平台，可帮助开发者轻松地创建、部署和运行应用程序。Docker使开发人员能够在一个独立的容器中打包应用程序及其依赖项，可以将应用程序移植到任何其他环境中。</p>
<h3 id="Doker安装"><a href="#Doker安装" class="headerlink" title="Doker安装"></a>Doker安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#卸载系统之前可能安装的docker</span></span><br><span class="line"><span class="built_in">sudo</span> yum remove docker \</span><br><span class="line">    docker-client \</span><br><span class="line">    docker-client-latest \</span><br><span class="line">    docker-common \</span><br><span class="line">    docker-latest \</span><br><span class="line">    docker-latest-logrotate \</span><br><span class="line">    docker-logrotate \</span><br><span class="line">    docker-engine</span><br><span class="line"></span><br><span class="line"><span class="comment">#安装必须的依赖</span></span><br><span class="line"><span class="built_in">sudo</span> yum install -y yum-utils \ </span><br><span class="line">device-mapper-persistent-data \ </span><br><span class="line">lvm2</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">#设置docker源地址</span></span><br><span class="line"><span class="built_in">sudo</span> yum-config-manager \ </span><br><span class="line">--add-repo \ </span><br><span class="line">https://download.docker.com/linux/centos/docker-ce.repo </span><br><span class="line"></span><br><span class="line"><span class="comment">#安装 docker</span></span><br><span class="line"><span class="built_in">sudo</span> yum install docker-ce docker-ce-cli containerd.io</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="启动-docker"><a href="#启动-docker" class="headerlink" title="启动 docker"></a>启动 docker</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#启动docker</span></span><br><span class="line"><span class="built_in">sudo</span> systemctl start docker</span><br><span class="line"><span class="comment">#查看docker服务状态 running 就是启动成功</span></span><br><span class="line"><span class="built_in">sudo</span> systemctl status docker</span><br><span class="line"></span><br><span class="line"><span class="comment">#设置 docker 开机自启</span></span><br><span class="line"><span class="built_in">sudo</span> systemctl <span class="built_in">enable</span> docker</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="docker-常用命令"><a href="#docker-常用命令" class="headerlink" title="docker 常用命令"></a>docker 常用命令</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#镜像命令</span></span><br><span class="line">docker images：列出所有镜像</span><br><span class="line">docker search [image]：搜索 Docker 镜像</span><br><span class="line">docker pull [image]：拉取指定镜像</span><br><span class="line">docker rmi [image]：删除指定镜像</span><br><span class="line"><span class="comment">#容器命令</span></span><br><span class="line">docker ps：列出当前所有正在运行的容器</span><br><span class="line">docker ps -a：列出所有容器，包括已经停止的容器</span><br><span class="line">docker create [image]：创建一个新的容器，但不启动它</span><br><span class="line">docker start [container]：启动一个容器</span><br><span class="line">docker stop [container]：停止一个容器</span><br><span class="line">docker <span class="built_in">rm</span> [container]：删除一个容器</span><br><span class="line">docker <span class="built_in">exec</span> -it [container] [<span class="built_in">command</span>]：在运行中的容器中执行命令</span><br><span class="line"><span class="comment">#其他命令</span></span><br><span class="line">docker info：显示 Docker 系统信息</span><br><span class="line">docker version：显示 Docker 版本信息</span><br><span class="line">docker logs [container]：查看容器的日志</span><br><span class="line">docker network <span class="built_in">ls</span>：列出 Docker 网络</span><br><span class="line">docker network create [network]：创建一个新的 Docker 网络</span><br><span class="line">docker network connect [network] [container]：将容器连接到指定的 Docker 网络</span><br><span class="line">docker network disconnect [network] [container]：将容器从指定的 Docker 网络中断开连接 </span><br><span class="line"></span><br></pre></td></tr></table></figure>
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://pengzzhao.github.io/2024/10/09/Docker%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/" data-id="cm21irup00000t6d81hle4nua" class="article-share-link">分享到</a>
      

      

      
    </footer>
  </div>
  
</article>


  
    <article id="post-Harbor仓库安装教程" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2024/10/09/Harbor%E4%BB%93%E5%BA%93%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/" class="article-date">
  <time datetime="2024-10-08T16:00:00.000Z" itemprop="datePublished">2024-10-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2024/10/09/Harbor%E4%BB%93%E5%BA%93%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/">Harbor仓库安装教程</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Harbor简介"><a href="#Harbor简介" class="headerlink" title="Harbor简介"></a>Harbor简介</h3><p>Harbor是一个开源的Docker镜像仓库管理工具，可以通过它快速的建立起自己的私有仓库。</p>
<p><strong>配置文件harbor.yml，只会在第一次启动Harbor时生效，之后对这些参数的更新harbor.yml将被忽略</strong></p>
<h3 id="Harbor部署"><a href="#Harbor部署" class="headerlink" title="Harbor部署"></a>Harbor部署</h3><p>Harbor的压缩包下载地址 <a target="_blank" rel="noopener" href="https://github.com/goharbor/harbor/releases/download/v2.11.0/harbor-offline-installer-v2.11.0.tgz">harbor-v2.11.0</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#下载安装包</span></span><br><span class="line">wget https://github.com/goharbor/harbor/releases/download/v2.11.0/harbor-offline-installer-v2.11.0.tgz</span><br><span class="line"><span class="comment">#解压缩到指定位置</span></span><br><span class="line">tar zxvf harbor-offline-installer-v2.11.0.tgz -C /usr/local/</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>修改harbor安装的配置文件</p>
<p><strong>使用http请注释掉https相关配置</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#编辑配置文件</span></span><br><span class="line">vim /usr/local/harbor/harbor.yml</span><br><span class="line"><span class="comment">#修改hostname设置服务器的IP或域名</span></span><br><span class="line">hostname = 192.168.1.100</span><br><span class="line"><span class="comment">#配置管理员的初始密码</span></span><br><span class="line"><span class="comment">#默认的用户名/密码是 admin/Harbor12345</span></span><br><span class="line">harbor_admin_password = Harbor12345</span><br></pre></td></tr></table></figure>


<h3 id="启动-Harbor"><a href="#启动-Harbor" class="headerlink" title="启动 Harbor"></a>启动 Harbor</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /usr/local/harbor/</span><br><span class="line"><span class="comment">#执行./prepare 命令生成相关配置文件</span></span><br><span class="line">./prepare</span><br><span class="line"><span class="comment">#执行./install.sh 命令,创建相关容器，启动harbor</span></span><br><span class="line">./install.sh</span><br></pre></td></tr></table></figure>
<p>查看 Harbor 容器状态</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">docker ps </span><br><span class="line"><span class="comment">#harbor相关容器全是up状态说明启动成功</span></span><br></pre></td></tr></table></figure>
<p>浏览器访问：<a target="_blank" rel="noopener" href="http://192.168.1.100/">http://192.168.1.100</a> 登录 Harbor WEB UI 界面，默认的管理员用户名和密码是 admin&#x2F;Harbor12345</p>
<h3 id="新建项目"><a href="#新建项目" class="headerlink" title="新建项目"></a>新建项目</h3><p>输入项目名称 common 确认后创建成功</p>
<h3 id="登录-Harbor"><a href="#登录-Harbor" class="headerlink" title="登录 Harbor"></a>登录 Harbor</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#其他docker访问harbor仓库 首先使用有效账号登录到harbor仓库</span></span><br><span class="line">docker login [-u admin -p Harbor12345] http://192.168.1.100:80</span><br><span class="line"></span><br><span class="line"><span class="comment">#http无法访问仓库时，docker配置文件添加如下配置</span></span><br><span class="line"><span class="built_in">cat</span> /etc/docker/daemon.json </span><br><span class="line"> </span><br><span class="line">&#123;</span><br><span class="line">	<span class="string">&quot;insecure-registries&quot;</span>: [<span class="string">&quot;http://192.168.1.100:80&quot;</span>]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="推送镜像到Harbor仓库"><a href="#推送镜像到Harbor仓库" class="headerlink" title="推送镜像到Harbor仓库"></a>推送镜像到Harbor仓库</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#本地镜像打Tag</span></span><br><span class="line">docker tag rabbitmq:management 192.168.1.100:80/common/rabbitmq:management</span><br><span class="line"><span class="comment">#推送到Harbor仓库</span></span><br><span class="line">docker push 192.168.1.100:80/common/rabbitmq:management</span><br><span class="line"></span><br><span class="line"><span class="comment">#从Harbor仓库拉去镜像</span></span><br><span class="line">docker pull 192.168.1.100:80/common/rabbitmq:management</span><br><span class="line"></span><br></pre></td></tr></table></figure>
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://pengzzhao.github.io/2024/10/09/Harbor%E4%BB%93%E5%BA%93%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/" data-id="cm21iw0sb0000vud82splcho9" class="article-share-link">分享到</a>
      

      

      
    </footer>
  </div>
  
</article>


  
    <article id="post-Jenkins安装教程" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2024/10/09/Jenkins%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/" class="article-date">
  <time datetime="2024-10-08T16:00:00.000Z" itemprop="datePublished">2024-10-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2024/10/09/Jenkins%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/">Jenkins安装教程</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Jenkins简介"><a href="#Jenkins简介" class="headerlink" title="Jenkins简介"></a>Jenkins简介</h3><p>Jenkins是一个开源软件项目，是基于Java开发的一种持续集成工具，用于监控持续重复的工作，旨在提供一个开放易用的软件平台，使软件的持续集成变成可能。</p>
<h3 id="Jenkins安装"><a href="#Jenkins安装" class="headerlink" title="Jenkins安装"></a>Jenkins安装</h3><p>Docker 搭建 Jenkins 容器</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#查询镜像</span></span><br><span class="line">docker search jenkins</span><br><span class="line"></span><br><span class="line"><span class="comment">#下载镜像</span></span><br><span class="line">docker pull jenkins/jenkins</span><br><span class="line"></span><br><span class="line"><span class="comment">#查看镜像</span></span><br><span class="line">docker images</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="启动Jenkins容器"><a href="#启动Jenkins容器" class="headerlink" title="启动Jenkins容器"></a>启动Jenkins容器</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>


<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#创建文件夹</span></span><br><span class="line"><span class="built_in">mkdir</span> -p /home/jenkins_home</span><br><span class="line"><span class="comment">#权限</span></span><br><span class="line"><span class="built_in">chmod</span> 777 /home/jenkins_home</span><br><span class="line"></span><br><span class="line"><span class="comment">#启动Jenkins容器</span></span><br><span class="line">docker run -d -uroot -p 9095:8080 -p 50000:50000 --name jenkins -v /home/jenkins_home:/var/jenkins_home -v /etc/localtime:/etc/localtime jenkins/jenkins</span><br><span class="line"></span><br><span class="line"><span class="comment">#日志查看 有初始化密码</span></span><br><span class="line">docker logs jenkins</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>浏览器输入http:&#x2F;&#x2F;服务器IP:端口Port 即可访问jenkins管理页面</p>

      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://pengzzhao.github.io/2024/10/09/Jenkins%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/" data-id="cm21jfhzd00003ed8gcgm52kl" class="article-share-link">分享到</a>
      

      

      
    </footer>
  </div>
  
</article>


  

</section>
      
      <aside id="sidebar">
  
    
  
    
  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2024/10/">十月 2024</a><span class="archive-list-count">4</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">近期文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2024/10/11/Podman%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/">Podman安装教程</a>
          </li>
        
          <li>
            <a href="/2024/10/09/Docker%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/">Docker安装教程</a>
          </li>
        
          <li>
            <a href="/2024/10/09/Harbor%E4%BB%93%E5%BA%93%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/">Harbor仓库安装教程</a>
          </li>
        
          <li>
            <a href="/2024/10/09/Jenkins%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/">Jenkins安装教程</a>
          </li>
        
      </ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">友情链接</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="http://arvinxiang.com" target="_blank">主题作者</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
      
    </div>
    <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2024 Evelia<br>
      Powered by <a href="//hexo.io/" target="_blank">Hexo</a>
      .
      Theme by <a href="https://github.com/xiangming/landscape-plus" target="_blank">Landscape-plus</a>
    </div>
  </div>
</footer>
  </div>
  <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
  <!-- totop start -->
<div id="totop">
<a title="返回顶部"><img src="/img/scrollup.png"/></a>
</div>

<!-- totop end -->


<!-- 百度分享 start -->

<!-- 百度分享 end -->

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>





<script src="/js/script.js"></script>


</div>
</body>
</html>
